﻿<UserControl x:Class="Reflection.Controls.TypesListBoxControl"
			 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
			 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
			 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
			 xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:c="clr-namespace:Reflection.Controls"
			 mc:Ignorable="d" 
			 >
    <UserControl.Resources>
        <ResourceDictionary>
            <DataTemplate x:Key="SelectedTypeListBoxItemTemplate">
                <StackPanel Orientation="Vertical">                    
                    <c:TypesInfoControl MaxHeight="250pt" />
                </StackPanel>                
            </DataTemplate>
            <DataTemplate x:Key="TypesListBoxItemTemplate">
                <TextBlock Text="{Binding AssemblyQualifiedName}" FontWeight="Bold" TextWrapping="Wrap" />                
            </DataTemplate>
            <Style x:Key="TypesListBoxItemStyle" TargetType="ListBoxItem">
                <Setter Property="MaxHeight" Value="250pt" />
                <Setter Property="HorizontalContentAlignment" Value="Stretch" />
                <Setter Property="ContentTemplate" Value="{StaticResource TypesListBoxItemTemplate}" />
                <Style.Triggers>
                    <Trigger Property="IsSelected" Value="True">
                        <Setter Property="ContentTemplate" Value="{StaticResource SelectedTypeListBoxItemTemplate}" />
                    </Trigger>
                </Style.Triggers>
            </Style>
            <Style x:Key="TypesListBoxStyle" TargetType="ListBox">
                <Setter Property="ItemContainerStyle" Value="{StaticResource TypesListBoxItemStyle}" />
                <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
                <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled" />
                <Setter Property="ItemsSource" Value="{Binding Types, RelativeSource={RelativeSource AncestorType=UserControl}}" />
            </Style>
        </ResourceDictionary>
    </UserControl.Resources>
    <ListBox Style="{StaticResource TypesListBoxStyle}" 
                />
</UserControl>
